package cn.ulc.socket.weapp.controller;

import cn.ulc.common.model.param.PaginationParam;
import cn.ulc.socket.weapp.model.param.UserFavoriteGoodsParam;
import cn.ulc.socket.weapp.service.UserFavoriteGoodsServ;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import javax.validation.constraints.Min;
import cn.ulc.common.util.Result;


/*
*
* gen controller 2019-06-22
*/
@Validated
@RestController
@RequestMapping("/wechat/userFavoriteGoods")
public class UserFavoriteGoodsCtrl {

    @Autowired
    UserFavoriteGoodsServ userFavoriteGoodsServ;

    @GetMapping("/")
    public Result findList(PaginationParam param) {
        return Result.success(userFavoriteGoodsServ.findList(param));
    }
    @PostMapping(value = "")
    public Result saveOne(@Validated @RequestBody UserFavoriteGoodsParam param) {
        return Result.success(userFavoriteGoodsServ.save(param));
    }
    @DeleteMapping(value = "/{id}")
    public Result deleteOne(@PathVariable @Min(1) Long id) {
        return Result.success(userFavoriteGoodsServ.deleteOne(id));
    }

}
